home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Nejlepší hry
/
Nejlepsi hry.iso
/
hry
/
sea of chaos
/
sea_install.msi
/
_15C39AAA7726369D39812BD40F01CF6A
/
_63796D61F2D24D28AD6ED46D5473AD98
< prev
next >
Wrap
Text File
|
2005-02-12
|
1KB
|
59 lines
//wake in water particle shader
//Luke Lenhart
//(C)2004-2005 Digipen Institute of Technology
//input position:
//x,y = side of particle (either -1 or 1)
//z = size of particle
//input vertex color:
//a = alpha;
//r(x) = x direction of wake
//g(y) = y direction of wake
//b = rotation angle of particle
//input tex coord = position in space
//world,view,projection transform
float4x4 matViewProj;
//shader input
struct VS_INPUT
{
float4 Pos : POSITION;
float4 Clr : COLOR;
float2 Trans : TEXCOORD0;
};
//shader output
struct VS_OUTPUT
{
float4 Pos : POSITION;
float2 Tex : TEXCOORD0;
float4 Clr : COLOR;
};
//shader code
VS_OUTPUT VShader(VS_INPUT In)
{
VS_OUTPUT Out;
//rotate and scale particle (model space)
In.Clr.b*=3.14159*2;
float2x2 matRot={cos(In.Clr.b),sin(In.Clr.b),-sin(In.Clr.b),cos(In.Clr.b)};
float4 pos;
pos.xy=mul(matRot,In.Pos.xy)*In.Pos.z;
pos.z=pos.w=1;
//translate and transform it
pos.xy+=In.Trans;
Out.Pos=mul(matViewProj,pos);
Out.Tex=In.Pos.xy*0.5f + 0.5f;
//make color of wake
Out.Clr=float4(1,1,1,In.Clr.a);
//spit out the results
return Out;
}